use std::{net::SocketAddr, sync::OnceLock};

use super::TransportProtocol;


///得到所需要的对外呼叫的对象
#[inline]
pub(crate) fn get_external_callout(peer_addr: &SocketAddr) -> TransportProtocol {
	external_gateway().set_peer_addr(peer_addr)
}

pub(crate) static ISP_GW: OnceLock<TransportProtocol> = OnceLock::new();
pub(crate) static EXTERNAL_GW: OnceLock<TransportProtocol> = OnceLock::new();

///向默认网关发送的发送者
#[inline]
pub(crate) fn default_gateway() -> TransportProtocol {
	ISP_GW.get().unwrap().clone()
}
///给出当前对外呼叫网关
#[inline]
pub(crate) fn external_gateway() -> TransportProtocol {
	EXTERNAL_GW.get().unwrap().clone()
}
